﻿using System.Collections.Generic;
using System.Windows;
using MSDNWebcast.Service;
using MSDNWebcast.ViewModels;
using MSDNWebcast.Models;

namespace MSDNWebcast
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private void OnStartup(object sender, StartupEventArgs e)
        {
            var types = new List<FileType>
                            {
                                new FileType {ID = "slides", FileExtension = "", Name = "幻灯片"},
                                new FileType {ID = "video", FileExtension = ".wmv", Name = "视频", CanPlay = true},
                                new FileType {ID = "code", FileExtension = "", Name = "源码"},
                                new FileType {ID = "qa", FileExtension = ".qa", Name = "QA"},
                                new FileType {ID = "mp3", FileExtension = ".mp3", Name = "MP3", CanPlay = true},
                                new FileType {ID = "mp4", FileExtension = ".mp4", Name = "MP4", CanPlay = true},
                                new FileType {ID = "wmv", FileExtension = ".wmv", Name = "WMV", CanPlay = true}
                            };

            ServiceFactory.Instance.InjectServices(new List<object>()
                                                       {
                                                           new CourseService("info.xml", types),
                                                           new DownloadService()
                                                       });
            var view = new Shell { DataContext = new MainViewModel() };
            view.Show();
        }
    }
}
